using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PathBlock : MonoBehaviour
{
    public BlockData data;
    public Dictionary<Directions, PathBlock> neighborsDict = new Dictionary<Directions, PathBlock>();
    public PathBlock previous=null;

    public void ChangeColor(Color32 color)
    {
        MeshRenderer meshRenderer=this.GetComponent<MeshRenderer>();
        meshRenderer.material.color = color;      
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.blue;
        foreach (var item in neighborsDict.Values)
        {
            Gizmos.DrawSphere(item.transform.position + new Vector3(0, 0.5f, 0), 0.1f);
            Gizmos.DrawLine(this.transform.position + new Vector3(0, 0.5f, 0), item.transform.position + new Vector3(0, 0.5f, 0));
        }
    }
}

[System.Serializable]
public struct BlockData
{
    public int mX;
    public int mY;
    public bool isObstacle;
    public bool isStepped;    
}

public enum Directions
{
    forward,
    forward_right,
    right,
    back_right,
    back,
    back_left,
    left,
    forward_left
}
